home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / CCDBMS.ZIP / DBCMD.H < prev    next >
C/C++ Source or Header  |  1997-03-18  |  1KB  |  59 lines

  1. // =================================================================
  2. // Dbase.cpp 
  3. // =================================================================
  4. // Harold Kasperink / John Dekker 
  5. // Dr. Dobb's Journal 1997
  6. // =================================================================
  7. // Dbase command class 
  8. // =================================================================
  9. #ifndef _DBCMD_H
  10. #define _DBCMD_H
  11.  
  12. #ifdef _WIN32
  13. #include <afxwin.h>
  14. #endif
  15.  
  16. class CDbase;
  17.  
  18. ////////////////////////////////////////////////////////////////////
  19. // CDbCommand::CDbCommand
  20. ////////////////////////////////////////////////////////////////////
  21. class CDbCommand
  22. {
  23. private:
  24.     friend class CDbase;
  25.     CDbase *    m_pDbase;
  26.  
  27. protected:
  28.     long        m_lSql;
  29.     const char *m_pszFile;
  30.     long        m_lLine;
  31.  
  32. public:
  33.     CDbCommand();
  34.     CDbCommand(CDbase &dbase);
  35.  
  36.     virtual ~CDbCommand();
  37.  
  38.     // You should call dbase.Do(this)
  39.     virtual void    Do() = 0;
  40.  
  41.     // Set operations used for Error handling
  42.     void            Location(const char *pszFile, long lLine);
  43.     void            Sql(long lSql);
  44.  
  45.     // Throws database exception
  46.     void            ThrowDbError(boolean bUnlock = TRUE);
  47.  
  48.     // Get and set functions
  49.     CDbase *        Dbase();
  50.     void            Dbase(CDbase &dbase);
  51.     
  52.  
  53. private:
  54.     // Is called by database object to instruct command to go !
  55.     virtual long    Execute() = 0;
  56. };
  57.  
  58. #endif
  59.